//StButton -> style button
import { BtnStyleContext } from '../../context';

class StButton extends React.Component {
  render() {
    return (
      // {...this.props} -> innerHTML有可能是文本有可能是子元素
      //将剩余的子元素都放一起
      <BtnStyleContext.Consumer>
        {({ style, doClick }) => {
          // console.log(this.props.children);
          //['Header(', '未登录', ')']

          return (
            <button style={style} onClick={doClick} {...this.props}></button>
          );
        }}
      </BtnStyleContext.Consumer>
    );
  }
}

export default StButton;
